package com.qf.smsplatform.deadletter.listener;

import com.qf.smsplatform.deadletter.config.DelayedConfig;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.io.IOException;

@Component
public class DelayedListener {

    @RabbitListener(queues = DelayedConfig.DELAYED_QUEUE)
    public void consume(String msg, Channel channel, Message message) throws IOException {
        System.out.println(System.currentTimeMillis() + "接收到延迟队列的消息:" + msg);
        channel.basicAck(message.getMessageProperties().getDeliveryTag(),false);
    }


}
